package c.e.a.b.f.b;

import android.os.RemoteException;
import c.e.a.b.e.c.v8;
import com.google.android.gms.measurement.internal.zzn;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class v7 implements Runnable {
    public final /* synthetic */ AtomicReference a;
    public final /* synthetic */ zzn b;
    public final /* synthetic */ q7 c;

    public v7(q7 q7Var, AtomicReference atomicReference, zzn zzn) {
        this.c = q7Var;
        this.a = atomicReference;
        this.b = zzn;
    }

    public final void run() {
        synchronized (this.a) {
            try {
                if (v8.a() && this.c.a.g.o(p.H0) && !this.c.l().y().k()) {
                    this.c.d().k.a("Analytics storage consent denied; will not get app instance id");
                    this.c.n().g.set(null);
                    this.c.l().l.b(null);
                    this.a.set(null);
                    this.a.notify();
                    return;
                }
                q7 q7Var = this.c;
                i3 i3Var = q7Var.d;
                if (i3Var == null) {
                    q7Var.d().f.a("Failed to get app instance id");
                    this.a.notify();
                    return;
                }
                this.a.set(i3Var.u0(this.b));
                String str = (String) this.a.get();
                if (str != null) {
                    this.c.n().g.set(str);
                    this.c.l().l.b(str);
                }
                this.c.F();
                this.a.notify();
            } catch (RemoteException e) {
                try {
                    this.c.d().f.b("Failed to get app instance id", e);
                    this.a.notify();
                } catch (Throwable th) {
                    this.a.notify();
                }
            }
        }
    }
}
